#include <iostream>
using namespace std;

int main()
{
	int d;
	cin >> d;
	for (unsigned int n; d-- && cin >> n; cout << endl) {
		cout << __builtin_ffs(n) - 1;
		n &= n - 1;
		for (;n; n &= n - 1) cout << ' ' << __builtin_ffs(n) - 1;
	}
	return 0;
}
